import sys

result = {}

for line in sys.stdin:
    line = line.strip()
    key = line.split("\t")[0]
    value = int(line.split("\t")[1])

    if key in result:
        result[key] = result[key] + value
    else:
        result[key] = value

for key, value in result.items():
	sys.stdout.write("%s\t%s\n" % (key, str(value)))